<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>async函数</title>
</head>
<body>
	<script>
		// then
		async function main(){
			//1. 如果返回值是一个非promise对象，则返回一个resolved的promise对象
			//return 'ok'
			//2. 如果返回值是一个promise对象，则直接返回这个promise对象
			//return new Promise((resolve,reject)=>{
			//	//resolve('ok')
			//	reject('err')
			//})
			//3. 如果抛出异常，则返回一个rejected的promise对象
			throw "oh no"
		}

		let result = main()
		console.log(result);
		
	</script>
</body>
</html>